(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 8.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       157,          7]
NotebookDataLength[      9033,        270]
NotebookOptionsPosition[      8554,        248]
NotebookOutlinePosition[      8911,        264]
CellTagsIndexPosition[      8868,        261]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[{
 RowBox[{
  RowBox[{"ncdf", "[", "x_", "]"}], ":=", 
  RowBox[{
   RowBox[{"1", "/", "2"}], "*", 
   RowBox[{"(", 
    RowBox[{"1", "+", 
     RowBox[{"Erf", "[", 
      RowBox[{"x", "/", 
       RowBox[{"Sqrt", "[", "2", "]"}]}], "]"}]}], 
    ")"}]}]}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"cor", "[", 
   RowBox[{"t_", ",", "tj_"}], "]"}], ":=", 
  RowBox[{
   RowBox[{
    RowBox[{"(", 
     RowBox[{"d", "+", 
      RowBox[{"a", "*", 
       RowBox[{"(", 
        RowBox[{"tj", "-", "t"}], ")"}]}]}], ")"}], "*", 
    RowBox[{"Exp", "[", 
     RowBox[{
      RowBox[{"-", "b"}], "*", 
      RowBox[{"(", 
       RowBox[{"tj", "-", "t"}], ")"}]}], "]"}]}], "+", "c"}]}]}], "Input",
 CellChangeTimes->{{3.5309375776073675`*^9, 3.530937598028536*^9}, {
  3.5309377992280436`*^9, 3.5309378398523674`*^9}, {3.5309394484603744`*^9, 
  3.5309394576048975`*^9}, {3.5309398545566015`*^9, 3.530939863844133*^9}, {
  3.530945140939308*^9, 3.53094515595212*^9}}],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Integrate", "[", 
  RowBox[{
   RowBox[{
    RowBox[{"cor", "[", 
     RowBox[{"x", ",", "tj"}], "]"}], "*", 
    RowBox[{"cor", "[", 
     RowBox[{"x", ",", "ti"}], "]"}]}], ",", 
   RowBox[{"{", 
    RowBox[{"x", ",", "x0", ",", "x1"}], "}"}]}], "]"}]], "Input",
 CellChangeTimes->{{3.530938100482274*^9, 3.5309381711653175`*^9}, 
   3.5309392079186163`*^9, {3.5309394622601633`*^9, 3.530939476908002*^9}, {
   3.5309397146766014`*^9, 3.530939714940616*^9}}],

Cell[BoxData[
 RowBox[{
  FractionBox["1", 
   RowBox[{"4", " ", 
    SuperscriptBox["b", "3"]}]], 
  RowBox[{
   SuperscriptBox["\[ExponentialE]", 
    RowBox[{
     RowBox[{"-", "b"}], " ", 
     RowBox[{"(", 
      RowBox[{"ti", "+", "tj"}], ")"}]}]], " ", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{
      SuperscriptBox["a", "2"], " ", 
      RowBox[{"(", 
       RowBox[{
        RowBox[{
         RowBox[{"-", 
          SuperscriptBox["\[ExponentialE]", 
           RowBox[{"2", " ", "b", " ", "x0"}]]}], " ", 
         RowBox[{"(", 
          RowBox[{"1", "+", 
           RowBox[{"b", " ", 
            RowBox[{"(", 
             RowBox[{"ti", "+", "tj", "-", 
              RowBox[{"2", " ", "x0"}]}], ")"}]}], "+", 
           RowBox[{"2", " ", 
            SuperscriptBox["b", "2"], " ", 
            RowBox[{"(", 
             RowBox[{"ti", "-", "x0"}], ")"}], " ", 
            RowBox[{"(", 
             RowBox[{"tj", "-", "x0"}], ")"}]}]}], ")"}]}], "+", 
        RowBox[{
         SuperscriptBox["\[ExponentialE]", 
          RowBox[{"2", " ", "b", " ", "x1"}]], " ", 
         RowBox[{"(", 
          RowBox[{"1", "+", 
           RowBox[{"b", " ", 
            RowBox[{"(", 
             RowBox[{"ti", "+", "tj", "-", 
              RowBox[{"2", " ", "x1"}]}], ")"}]}], "+", 
           RowBox[{"2", " ", 
            SuperscriptBox["b", "2"], " ", 
            RowBox[{"(", 
             RowBox[{"ti", "-", "x1"}], ")"}], " ", 
            RowBox[{"(", 
             RowBox[{"tj", "-", "x1"}], ")"}]}]}], ")"}]}]}], ")"}]}], "-", 
     RowBox[{"2", " ", 
      SuperscriptBox["b", "2"], " ", 
      RowBox[{"(", 
       RowBox[{
        RowBox[{"2", " ", "c", " ", "d", " ", 
         RowBox[{"(", 
          RowBox[{
           SuperscriptBox["\[ExponentialE]", 
            RowBox[{"b", " ", "ti"}]], "+", 
           SuperscriptBox["\[ExponentialE]", 
            RowBox[{"b", " ", "tj"}]]}], ")"}], " ", 
         RowBox[{"(", 
          RowBox[{
           SuperscriptBox["\[ExponentialE]", 
            RowBox[{"b", " ", "x0"}]], "-", 
           SuperscriptBox["\[ExponentialE]", 
            RowBox[{"b", " ", "x1"}]]}], ")"}]}], "+", 
        RowBox[{
         SuperscriptBox["d", "2"], " ", 
         RowBox[{"(", 
          RowBox[{
           SuperscriptBox["\[ExponentialE]", 
            RowBox[{"2", " ", "b", " ", "x0"}]], "-", 
           SuperscriptBox["\[ExponentialE]", 
            RowBox[{"2", " ", "b", " ", "x1"}]]}], ")"}]}], "+", 
        RowBox[{"2", " ", "b", " ", 
         SuperscriptBox["c", "2"], " ", 
         SuperscriptBox["\[ExponentialE]", 
          RowBox[{"b", " ", 
           RowBox[{"(", 
            RowBox[{"ti", "+", "tj"}], ")"}]}]], " ", 
         RowBox[{"(", 
          RowBox[{"x0", "-", "x1"}], ")"}]}]}], ")"}]}], "+", 
     RowBox[{"2", " ", "a", " ", "b", " ", 
      RowBox[{"(", 
       RowBox[{
        RowBox[{"d", " ", 
         RowBox[{"(", 
          RowBox[{
           RowBox[{
            SuperscriptBox["\[ExponentialE]", 
             RowBox[{"2", " ", "b", " ", "x0"}]], " ", 
            RowBox[{"(", 
             RowBox[{
              RowBox[{"-", "1"}], "-", 
              RowBox[{"b", " ", 
               RowBox[{"(", 
                RowBox[{"ti", "+", "tj", "-", 
                 RowBox[{"2", " ", "x0"}]}], ")"}]}]}], ")"}]}], "+", 
           RowBox[{
            SuperscriptBox["\[ExponentialE]", 
             RowBox[{"2", " ", "b", " ", "x1"}]], " ", 
            RowBox[{"(", 
             RowBox[{"1", "+", 
              RowBox[{"b", " ", 
               RowBox[{"(", 
                RowBox[{"ti", "+", "tj", "-", 
                 RowBox[{"2", " ", "x1"}]}], ")"}]}]}], ")"}]}]}], ")"}]}], 
        "+", 
        RowBox[{"2", " ", "c", " ", 
         RowBox[{"(", 
          RowBox[{
           RowBox[{
            SuperscriptBox["\[ExponentialE]", 
             RowBox[{"b", " ", 
              RowBox[{"(", 
               RowBox[{"tj", "+", "x0"}], ")"}]}]], " ", 
            RowBox[{"(", 
             RowBox[{
              RowBox[{"-", "1"}], "-", 
              RowBox[{"b", " ", "ti"}], "+", 
              RowBox[{"b", " ", "x0"}]}], ")"}]}], "+", 
           RowBox[{
            SuperscriptBox["\[ExponentialE]", 
             RowBox[{"b", " ", 
              RowBox[{"(", 
               RowBox[{"ti", "+", "x0"}], ")"}]}]], " ", 
            RowBox[{"(", 
             RowBox[{
              RowBox[{"-", "1"}], "-", 
              RowBox[{"b", " ", "tj"}], "+", 
              RowBox[{"b", " ", "x0"}]}], ")"}]}], "+", 
           RowBox[{
            SuperscriptBox["\[ExponentialE]", 
             RowBox[{"b", " ", 
              RowBox[{"(", 
               RowBox[{"tj", "+", "x1"}], ")"}]}]], " ", 
            RowBox[{"(", 
             RowBox[{"1", "+", 
              RowBox[{"b", " ", "ti"}], "-", 
              RowBox[{"b", " ", "x1"}]}], ")"}]}], "+", 
           RowBox[{
            SuperscriptBox["\[ExponentialE]", 
             RowBox[{"b", " ", 
              RowBox[{"(", 
               RowBox[{"ti", "+", "x1"}], ")"}]}]], " ", 
            RowBox[{"(", 
             RowBox[{"1", "+", 
              RowBox[{"b", " ", "tj"}], "-", 
              RowBox[{"b", " ", "x1"}]}], ")"}]}]}], ")"}]}]}], ")"}]}]}], 
    ")"}]}]}]], "Output",
 CellChangeTimes->{{3.530938116786207*^9, 3.530938137421387*^9}, 
   3.5309381716473446`*^9, 3.5309392088636703`*^9, 3.5309394825623245`*^9, 
   3.5309397231850877`*^9, 3.5309398917747307`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"CForm", "[", "%", "]"}]], "Input",
 CellChangeTimes->{{3.530939622764344*^9, 3.5309396243314333`*^9}}],

Cell["\<\
(Power(a,2)*(-(Power(E,2*b*x0)*(1 + b*(ti + tj - 2*x0) + 2*Power(b,2)*(ti - \
x0)*(tj - x0))) + 
        Power(E,2*b*x1)*(1 + b*(ti + tj - 2*x1) + 2*Power(b,2)*(ti - x1)*(tj \
- x1))) - 
     2*Power(b,2)*(2*c*d*(Power(E,b*ti) + Power(E,b*tj))*(Power(E,b*x0) - \
Power(E,b*x1)) + 
        Power(d,2)*(Power(E,2*b*x0) - Power(E,2*b*x1)) + \
2*b*Power(c,2)*Power(E,b*(ti + tj))*(x0 - x1)) + 
     2*a*b*(d*(Power(E,2*b*x0)*(-1 - b*(ti + tj - 2*x0)) + Power(E,2*b*x1)*(1 \
+ b*(ti + tj - 2*x1))) + 
        2*c*(Power(E,b*(tj + x0))*(-1 - b*ti + b*x0) + Power(E,b*(ti + \
x0))*(-1 - b*tj + b*x0) + 
           Power(E,b*(tj + x1))*(1 + b*ti - b*x1) + Power(E,b*(ti + x1))*(1 + \
b*tj - b*x1))))/
   (4.*Power(b,3)*Power(E,b*(ti + tj)))\
\>", "Output",
 CellChangeTimes->{3.530939624824462*^9, 3.530939730115484*^9, 
  3.530939895678954*^9}]
}, Open  ]]
},
WindowSize->{707, 867},
WindowMargins->{{Automatic, 580}, {7, Automatic}},
FrontEndVersion->"8.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (February 23, \
2011)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[557, 20, 978, 29, 43, "Input"],
Cell[CellGroupData[{
Cell[1560, 53, 484, 12, 27, "Input"],
Cell[2047, 67, 5478, 151, 149, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[7562, 223, 126, 2, 27, "Input"],
Cell[7691, 227, 847, 18, 118, "Output"]
}, Open  ]]
}
]
*)

(* End of internal cache information *)
